package dwarf

type Dwarfs []Dwarf

type Dwarf struct {
    pos Position
    vel Velocity
    stats Stats
}

type Cats []Cat

type Cat struct {
    pos Position
    vel Velocity
    stats Stats
}

type vec3D struct {
    x, y, z int
}

type Position vec3D

type Velocity vec3D

type Stats struct {
    health, str, dex, int, vit int
}

type Move struct {
    pos *Position
    vel *Velocity
}

type MoveSystem []Move

func (m MoveSystem) Update() {
    for i := range m {
        m[i].pos.x = m[i].pos.x + m[i].vel.x
        m[i].pos.y = m[i].pos.y + m[i].vel.y
        m[i].pos.z = m[i].pos.z + m[i].vel.z
    }
}

func NewDwarf(p Position, s Stats) {
    gDwarfs = append(gDwarfs, Dwarf{pos: p, stats: s})
    m := Move{&gDwarfs[len(gDwarfs)-1].pos, &gDwarfs[len(gDwarfs)-1].vel}
    gMoveSystem = append(gMoveSystem, m)
}

func NewCat(p Position, s Stats) {
    gCats = append(gCats, Cat{pos: p, stats: s})
    m := Move{&gCats[len(gCats)-1].pos, &gCats[len(gCats)-1].vel}
    gMoveSystem = append(gMoveSystem, m)
}

var (
    gMoveSystem MoveSystem
    gDwarfs Dwarfs
    gCats Cats
)
